<?php
$this->widget('application.extensions.fancybox.EFancyBox', array(
        'target'=>'a[rel=fancybox]',
        'config'=>array(),
    )
);
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/modal/dxtmodal.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/modal/modal.css');
/**
 * @var $model GuitarClass
 * @var $this TrainingController
 */
$this->breadcrumbs = array(
    'Khóa học' => array('training/index'),
    $model->training->name => array('training/view', 'vid' => $model->training->id, 'name' => Yii::app()->func->safeTitle($model->training->name)),
    $model->title,
);
$this->pageTitle = $model->title;
?>
<div class="left">
<div id="list-training">
    <h1 class="title"><?php echo $model->title; ?></h1>
    <abbr class="date">Ngày đăng: <?php echo date('d/m/Y',$model->create_time); ?></abbr>
    <div style="margin-top: 10px;">
        <?php echo $model->body;?><br/>
        Thuộc khóa học: <?php echo $model->training->name;?></div>
    <div>Thời gian học: từ <?php echo date('d/m/Y', $model->start_time);?>
        đến <?php echo date('d/m/Y', $model->end_time);?></div>
    <div>Học tại: <?php echo $model->facility->title; ?></div>
    <div>Địa chỉ: <?php echo $model->facility->address; ?></div>
    <div>
        Thông tin liên hệ:
        <br>- <?php echo $model->facility->teacher->name; ?>
        <br>- Điện thoại: <?php echo $model->facility->teacher->tel; ?>
        <br>- Email: <?php echo $model->facility->teacher->email; ?>
    </div>
    <div>
        <?php
        if ($model->end_time >= time()) {
            if (!$model->checkRegistered()) {
                echo ' &rArr; '.CHtml::link('Đăng ký',$this->createUrl('register', array('cid' => $model->id)),array('class'=>'reg'));
            }
            else {
                echo ' &rArr; Bạn đã đăng ký rồi';
            }
        }

        ?>
        <div id="regDialog"></div>
    </div>
</div>
</div>
<div class="right">
    <?php
    $this->beginWidget('zii.widgets.CPortlet', array('title' => 'Cơ sở đào tạo'));
    $this->widget('FacilityList');
    $this->endWidget();
    ?>
</div>
<script type="text/javascript">
    $(function(){
        $('.reg').dxtmodal({width:280,height:520,title:'Đăng ký học'});
    });
</script>